<?php

use think\migration\Seeder;
// use Faker;

class Users extends Seeder
{
    /**
     * Run Method.
     *
     * Write your database seeder using this method.
     *
     * More information on writing seeders is available here:
     * http://docs.phinx.org/en/latest/seeding.html
     */
    public function run()
    {
        $faker = Faker\Factory::create('zh_CN');
        $data = [];
        for ($i = 0; $i < 100; $i++) {
            $data[] = [
                'username'      => $faker->userName,
                'password'      => password_hash("123456",PASSWORD_DEFAULT),
                'mobile'         => $faker->phoneNumber,
                'last_login_time'    => date('Y-m-d H:i:s'),
                'login_status'     => 1,
                'login_code'=> mt_rand(5, 15),
                'last_login_ip'=>$faker->ipv4,
                // 'create_time'       => date('Y-m-d H:i:s'),
                'is_delete'=>0
            ];
            $this->table('users')->insert($data)->save();
        }
    }
}
